# 设计两个类
# 点包括x,y
# 矩形类 Reactangle类 属性有左上右下两个坐标
# 判断矩形面积和点在不在矩形内


# class Point():
#     def __init__(self, x1, y1):
#         self.x1 = x1
#         self.y1 = y1

# class Reactangle():
#     def __init__(self,x2,y2,x3,y3):
#         self.x2=x2
#         self.x3=x3
#         self.y2=y2
#         self.y3=y3

#     def area(self):
#         self.area=abs(self.x3-self.x2)*abs(self.y3-self.y2)
#         print('面积为{}'.format(self.area))
#         return self.area

# class Judgment():
#     def __init__ (self,a,b):
#         if b.x3<a.x1<b.x2 or b.x2<a.x1<b.x3:
#             if b.y3<a.y1<b.y2 or b.y2<a.y1<b.y3:
#                 print('在里面')
#             else:
#                 print('不在里面')
#         else:
#                 print('不在里面')


# b1=Point(8,3)
# r1=Reactangle(-2,-2,4,4)
# r1.area()
# Judgment(b1,r1)


# # 计算器
# class Calculator:
#     def __init__(self, a, b):
#         self.a = a
#         self.b = b

#     def add (self):
#         print(self.a+self.b)

# a1=Calculator(5,7)
# a1.add()
# 
# 因为没有必要传送参数顾使用静态方法更好 
# class Calculator():
#     @staticmethod
#     def add(a,b):
        
#         print(a+b)
#         return a+b 
# Calculator.add(4,5)


# #对生产对象进行计数
# class Person():
#     count=0
#     def __init__(self,name):
#         Person.count+=1
#         self.name=name


# p1=Person('aa')
# p1=Person('aa')
# p1=Person('aa')
# print(p1.count)

# 建立一个汽车auto对象,包括轮胎个数,颜色,速度 要求能加速 能减速,停车 再定义一个小汽车类carauto 继承auto 并添加空调,cd属性,并重新实现方法覆盖加速与减速


# class Auto:
#     def __init__(self, tires, colour, weight, speed):
#         self.tires = tires
#         self.colour = colour
#         self.weight = weight
#         self.speed = speed
#     def add_speed(self):
#         print('1m/s2在加速')
#     def sub_speed(self):
#         print('-1m/s2在减速')
#     def stop(self):
#         print('停车中')

# class CarAuto(Auto):
#     def __init__(self, tires, colour, weight, speed,airCon,cd):
#         super().__init__(tires, colour, weight, speed)
#         self.airCon=airCon
#         self.cd=cd
#     def add_speed(self):
#         print('2m/s2在加速')
#     def sub_speed(self):
#         print('-1.2m/s2在减速')


# car1=Auto(4,'yello',1.5,60)
# car1.add_speed()

# car2=CarAuto(3,'red',0.5,50,'Auto','sony')
# car2.add_speed()

# 存款Account 包括名字,银行余额,方法有存钱,取钱,查余
# 存款要注意存钱的格式
# 取钱时要判断够不够


# class Account():
#     def __init__(self, name, __bank_balance):
#         self.__bank_balance = __bank_balance * 1.0
#         self.name = name
    
#     def add_balance(self,money):
#         print('您存入{}元'.format(money*1.0))
#         self.__bank_balance=self.__bank_balance+money*1.0

#     def sun_balance(self,money):
#         print('您希望取出{}元'.format(money*1.0))
#         if self.__bank_balance > money:
#             self.__bank_balance-=money*1.0
#             print(('您取出{}元'.format(money*1.0)))
#         else:
#             print('对不起您的余额不足')
        
#     def show_balance(self):
#         print('您的余额是{}元'.format(self.__bank_balance))

        
# b1 = Account('小李',100)
# b1.add_balance(50)
# b1.show_balance()
# b1.sun_balance(100)
# b1.show_balance()
# b1.sun_balance(100)
# b1.show_balance()
        
        
